package com.ruoyi.pyo.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pyo.domain.PetYeahHallContent;
import com.ruoyi.pyo.service.IPetYeahHallContentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 宠物讲堂内容中心Controller
 * 
 * @author ruoyi
 * @date 2025-11-19
 */
@Api(tags = "宠物讲堂内容中心")
@RestController
@RequestMapping("/pyo/content")
public class PetYeahHallContentController extends BaseController
{
    @Autowired
    private IPetYeahHallContentService petYeahHallContentService;

    /**
     * 查询宠物讲堂内容中心列表
     */
    @ApiOperation("查询宠物讲堂内容中心列表")
    @PreAuthorize("@ss.hasPermi('pyo:content:list')")
    @GetMapping("/list")
    public TableDataInfo list(PetYeahHallContent petYeahHallContent)
    {
        startPage();
        List<PetYeahHallContent> list = petYeahHallContentService.selectPetYeahHallContentList(petYeahHallContent);
        return getDataTable(list);
    }

    /**
     * 导出宠物讲堂内容中心列表
     */
    @PreAuthorize("@ss.hasPermi('pyo:content:export')")
    @Log(title = "宠物讲堂内容中心", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PetYeahHallContent petYeahHallContent)
    {
        List<PetYeahHallContent> list = petYeahHallContentService.selectPetYeahHallContentList(petYeahHallContent);
        ExcelUtil<PetYeahHallContent> util = new ExcelUtil<PetYeahHallContent>(PetYeahHallContent.class);
        util.exportExcel(response, list, "宠物讲堂内容中心数据");
    }

    /**
     * 获取宠物讲堂内容中心详细信息
     */
    @ApiOperation("获取宠物讲堂内容中心详细信息")
    @PreAuthorize("@ss.hasPermi('pyo:content:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(petYeahHallContentService.selectPetYeahHallContentById(id));
    }

    /**
     * 新增宠物讲堂内容中心
     */
    @ApiOperation("新增宠物讲堂内容中心")
    @PreAuthorize("@ss.hasPermi('pyo:content:add')")
    @Log(title = "宠物讲堂内容中心", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PetYeahHallContent petYeahHallContent)
    {
        return toAjax(petYeahHallContentService.insertPetYeahHallContent(petYeahHallContent));
    }

    /**
     * 修改宠物讲堂内容中心
     */
    @ApiOperation("修改宠物讲堂内容中心")
    @PreAuthorize("@ss.hasPermi('pyo:content:edit')")
    @Log(title = "宠物讲堂内容中心", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PetYeahHallContent petYeahHallContent)
    {
        return toAjax(petYeahHallContentService.updatePetYeahHallContent(petYeahHallContent));
    }

    /**
     * 删除宠物讲堂内容中心
     */
    @ApiOperation("删除宠物讲堂内容中心")
    @PreAuthorize("@ss.hasPermi('pyo:content:remove')")
    @Log(title = "宠物讲堂内容中心", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(petYeahHallContentService.deletePetYeahHallContentByIds(ids));
    }
}
